import axios from "@/utils/requestUtils";
// 注册
export async function regist(params: any) {
    const { data } = await axios.get<{ data: any }>('/user/register', {
		...params
	});
	return data;
}
// 登录状态
export async function Login(params: any) {
    const { data } = await axios.post<{ data: any }>('user/login', {
		...params
	});
	return data;
}

//修改个人信息
export async function updateUserMsg(params: any) {
    const { data } = await axios.put<{ data: any }>('user/update', {
		...params
	});
	return data;
}

//根据歌曲id获取歌曲信息
export async function getSongOfId(id:number) {
    const { data } = await axios.get<{ data: ISong }>('/song/detail', {
		id:id,
	});
	return data;
}
//获取轮播数据
export async function getBanners() {
    const { data } = await axios.get<{ data: IBanner[] }>('/banner', {
	});
	return data;
}
//获取歌曲列表信息
export async function getSongs() {
    const { data } = await axios.get<{ data: ISong[] }>('/song/all', {
	});
	return data;
}
//获取所有歌单
export async function getAllPlayList() {
    const { data } = await axios.get<{ data: IPlayList[] }>('/playList', {
	});
	return data;
}
//返回某歌单的所有歌曲信息
export async function getPlayListSongDetail(id:number) {
    const { data } = await axios.get<{ data: ISong[] }>('/listSong/detail', {
		playListId:id,
	});
	return data;
}
//返回某歌单的歌单信息
export async function getPlayListById(id:number) {
    const { data } = await axios.get<{ data: IPlayList }>('/playList/detail', {
		id:id,
	});
	return data;
}
//返回所有评论，  type:1 歌单   type:2 歌曲
export async function getPlayListComment(params:any) {
    const { data } = await axios.get<{ data: any }>('/playListComment/detail', {
		...params
	});
	return data;
}
//返回当前用户的喜欢/收藏歌曲
export async function getLikeList(params: any) {
    const { data } = await axios.get<{ data: [] }>('/collection/detail', {
		...params
	});
	return data;
}
//返回当前用户的喜欢/收藏歌曲详细信息
// export async function getLiKeSongListDetail(id:number) {
//     const { data } = await axios.get<{ data: ISong[] }>('/collection/detailSong', {
// 		userId:id,
// 	});
// 	return data;
// }
//添加收藏歌曲,获取是否成功
export async function addLike(params: any) {
    const { data } = await axios.post<{ data: boolean }>('/collection/add', {
		...params
	});
	return data;
}
//取消收藏歌曲，获取是否成功
export async function deleteLike(params:any) {
    const { data } = await axios.delete<{ data: boolean }>('/collection/delete', {
		...params
	});
	return data;
}
//添加评论
export async function addPlayListComment(params:any) {
    const { data } = await axios.post<{ data: boolean }>('/comment/add', {
		...params
	});
	return data;
}
//删除歌单评论，根据评论id
export async function deletePlayListComment(id:number) {
    const { data } = await axios.delete<{ data: boolean }>('/comment/delete', {
		id:id,
	});
	return data;
}
//获取所有歌手
export async function getAllSinger() {
    const { data } = await axios.get<{ data: ISinger[] }>('/singer', {
	});
	return data;
}
//根据id获取歌手信息
export async function getSingerById(id:number) {
    const { data } = await axios.get<{ data: ISinger }>('/singer/detail', {
		id:id,
	});
	return data;
}
//根据歌手id获取该歌手所有信息
export async function getSongBySingerId(id:number) {
    const { data } = await axios.get<{ data: ISong[] }>('/song/singerAll', {
		id:id,
	});
	return data;
}
//获取所有音乐资讯
export async function getMusicInfo() {
	const { data } = await axios.get<{ data: any }>('/information/select');
	return data;
}
//获取所有音乐资讯详情
export async function getMusicInfoDetail(id: number) {
	const { data } = await axios.get<{ data: any }>('/information/detail', {
		id: id,
	});
	return data;
}
//获取MV数据
export async function getMvs(query:any) {
    const { data } = await axios.get<{ data: any }>('/mv/select', {query
	});
	return data;
}
//获取MV详情
export async function mvDetail(id:number) {
    const { data } = await axios.get<{ data: any }>('/mv/detail', {id
	});
	return data;
}
//添加/修改评分
export async function addOrUpdateRate(params:any) {
    const { data } = await axios.posts<{ data: any }>('/rate/addOrUpdate', {...params
	});
	return data;
}
//查询评分
export async function searchRate(params:any) {
    const { data } = await axios.posts<{ data: any }>('/rate/detail', {...params
	});
	return data;
}
// 搜索
export async function searchAll(query:any) {
    const { data } = await axios.get<{ data: any }>('/song/selectList', {query
	});
	return data;
}

// 获取所有歌曲
export async function allSong(query:any) {
    const { data } = await axios.get<{ data: any }>('/song/all', {query
	});
	return data;
}
